﻿using System;

namespace Mindless
{
    /// <summary>
    /// A vector, used to represent the direction and length of a move. These are immutable.
    /// </summary>
    struct Vector
    {
        /// <summary>
        /// Constructs a new location.
        /// </summary>
        public Vector(int x, int y)
        {
            this.x = x;
            this.y = y;
        }

        /// <summary>
        /// X-coord of the vector.
        /// </summary>
        public int X
        {
            get { return this.x; }
        }
        int x;

        /// <summary>
        /// Y-coord of the vector.
        /// </summary>
        public int Y
        {
            get { return this.y; }
        }
        int y;

        /// <summary>
        /// Adds two vectors together, producing a new vector.
        /// </summary>
        public static Vector operator+(Vector a, Vector b)
        {
            return new Vector(a.x + b.x, a.y + b.y);
        }

        /// <summary>
        /// Display string.
        /// </summary>
        public override string ToString()
        {
            return string.Format("({0},{1})", this.X, this.Y);
        }
    }
}
